import { http } from '@/utils/http'
import type {
  Category,
  HotBrand,
  Banner,
  NewGoods,
  Hot,
  Product,
  LatestTopic
} from './types.d'

/** 全部分类接口 */
export const categoryAPI = (): Promise<Category[]> => {
  return http.get<Category[]>('/home/category/head')
}

/** 热门品牌接口 */
export const hotBrandAPI = (limit?: number): Promise<HotBrand[]> => {
  return http.get<HotBrand[]>('/home/brand', { limit })
}

/** 轮播图 */
export const bannerAPI = (): Promise<Banner[]> => {
  return http.get<Banner[]>('/home/banner')
}

/** 新鲜好物 */
export const newGoodsListAPI = (limit?: number): Promise<NewGoods[]> => {
  return http.get<NewGoods[]>('/home/new', { limit })
}

/** 人气推荐 */
export const hotListAPI = (): Promise<Hot[]> => {
  return http.get<Hot[]>('home/hot')
}

/** 商品列表 */
export const productListAPI = (): Promise<Product[]> => {
  return http.get<Product[]>('/home/goods')
}

/** 最新专题 */
export const latestTopicAPI = (): Promise<LatestTopic[]> => {
  return http.get<LatestTopic[]>('/home/special')
}
